Search Database SQL / Scripts


  Help us in improving the repository. Add new Queries/Scripts through 'Submit Database SQL / Scripts ' link.





Database SQL / Scripts for '#Not in' - 3 Query/Script(s) found

 Sample 1. Oracle - Create Table with Primary Key, Not Null and Foreign Key Constraints

CREATE TABLE TABLE_NAME (
ID NUMBER CONSTRAINT ID_KEY PRIMARY KEY,
NAME VARCHAR(50) CONSTRAINT NAME_NOT_NULL NOT NULL,
CONSTRAINT NAME_FK FOREIGN KEY (NAME) REFERENCES OTHER_TABLE_NAME (NAME)
);

   Like      Feedback     create table  create table with foreign key


 Sample 2. Cursor to get Ids from one table and then insert records into another ( Get Employee Ids from EMPLOYEE Table and insert records within EMPLOYEE_SALARY with default salary of 1000 )

DECLARE
   cursor employeeIds IS
      select * from EMPLOYEE;

   BEGIN
      FOR rec IN employeeIds LOOP
         INSERT INTO EMPLOYEE_SALARY(ID, SALARY) VALUES(rec.ID, 1000);
      END LOOP;
END;

   Like      Feedback     cursor


 Sample 3. Get all Departments having no employees, Usage of not in

Select DEPT_NAME from DEPT where DEPT_ID not in ( Select distinct DEPT_ID from EMPLOYEE ) 

   Like      Feedback     Not in   Select



Subscribe to Java News and Posts. Get latest updates and posts on Java from Buggybread.com
Enter your email address:
Delivered by FeedBurner